public class T1 {
    public static void main(String[] args) {
//        四种九九乘法表
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j + "*" + i + "=" + (i * j) + " ");
            }
            System.out.println();
        }
        System.out.println("=========================");


        for (int i = 1; i <= 9; i++) {
            for (int j = 9 - i; j > 0; j--) {
                System.out.print("    ");
            }

            for (int j = 1; j <= i; j++) {
                System.out.printf("%d*%d=%d   ", j, i, j * i);
            }

            System.out.println();
        }
        System.out.println("-------------------");
        for (int i = 1; i <= 9; i++) {
            // 在每行开始添加适当数量的空格来形成倒金字塔形状
            for (int space = 0; space < (i - 1) * 4; space++) {
                System.out.print(" ");
            }

            // 输出当前行的乘法表，j 从 1 到 9-i+1
            for (int j = 1; j <= 9 - i + 1; j++) {
                System.out.printf("%d*%d=%d   ", j, i, j * i);
            }

            System.out.println();
        }
        System.out.println("--------------------");
        for (int i = 1; i <= 9; i++) {
            for (int space = 1; space < i; space++) {
                System.out.print("         ");
            }

            // 内循环输出每行的乘法表项，乘数从大到小
            for (int j = 9; j >= i; j--) {
                System.out.printf("%d*%d=%2d   ", i, j, i * j);
            }

            System.out.println();
        }
    }
}
